#include <iostream>

using namespace std;

int main()
{
    int a[100];
    int n,i,j;
    std::cout<<"n=";
    std::cin>>n;
    for (i=0;i<n;i++)
    {
        std::cout<<"a["<<i<<"]=";
        std::cin>>a[i];
    }
    //int ok=0;
    i=0;
    while ((i<n))
    {
        if (a[i]==0)
        {
            for (j=i;j<n-1;j++)
            {
                a[j]=a[j+1];
            }
            n=n-1;
            i=i-1;
        }
        i++;
    }
    for (i=0;i<n;i++)
    {
        std::cout<<"a["<<i<<"]="<<a[i]<<" ";
    }
    return 0;
}
